from flask import jsonify, Response, json


class ResponseUtils:
    def build_response(code, status, message, data=None, total=None, error_code=None):
        return Response(
            json.dumps({
                "code": code,
                "status": status,
                "msg": message,
                "errorCode": error_code,
                "data": data,
                "total": total
            }, ensure_ascii=False),  # 关闭 ASCII 转义
            mimetype='application/json'
        )
